import React, { Component } from 'react'
import { Form, Modal,  Input,Tabs } from 'antd'
const TabPane = Tabs.TabPane
const confirm = Modal.confirm;
import classnames from 'classnames/bind';
let cx = classnames.bind(styles);
const FormItem = Form.Item
import styles from './index.less'
// 引入列表页组件
import ListPage from 'widget/PageTmpl/ListPage'
const formItemLayout2 = {
    labelCol: { span: 4 },
    wrapperCol: { span: 16 },
};
export default class selectProjectModal extends Component {
    constructor(props) {
        super(props)
        this.state ={
            visible : this.props.visible || false,
            style : this.props.style || {},
            activityModalObj:{}
        }    
    }
    componentDidMount(){
        this.setState({
            activityModalObj:this.props.activityModalObj
        })
    }
    componentWillReceiveProps(props){
        // console.log(props)
        
    }
    changeTab_modal= (activityType)=> {
        let {activityModalObj, pageProps} = this.props
        activityModalObj.activityType = activityType
        this.setState({
            pageProps:pageProps
        })
    }
    getHref= (params) =>{
        return params
    }
     
    render() {
        let { visible,updateModal,pageProps,activityModalObj,form,confirmHref,destroyOnClose} = this.props
        let { getFieldDecorator, validateFields } = form
        let self = this
        return (
            <Modal
                visible={visible}
                onOk={()=>{
                    confirmHref(self.getHref)
                }}
                onCancel={() => {
                    updateModal(false)
                }}
                width={'80%'}
                destroyOnClose={destroyOnClose}
            >
                <div style={{padding: '10px'}}>
                <div className={'mgb1'}>选择活动</div>
                    <Tabs onChange={this.changeTab_modal} type="line" activeKey={activityModalObj.activityType + ''||""} animated={false}>
                    <TabPane tab="报名活动" key="1">
                        {/* <ListPage pageProps={pageProps['1']}/> */}
                    </TabPane>

                    <TabPane tab="自助购房" key="2">
                        {/* <ListPage pageProps={pageProps['2']}/> */}
                    </TabPane>

                    <TabPane tab="在线开盘" key="3">
                        {/* <ListPage pageProps={pageProps['3']}/> */}
                    </TabPane>
                    </Tabs>

                     {/*报名活动 1*/}
                     {
                    <div title="报名活动" className={cx(activityModalObj.activityType == '1' ? '' : 'hidden')}>
                        <ListPage pageProps={pageProps['1']}/>
                    </div>
                    }
                    
                    {/*自助购房 2*/}
                    {
                    <div title="自助购房" className={cx(activityModalObj.activityType == '2' ? '' : 'hidden')}>
                        <ListPage pageProps={pageProps['2']}/>
                    </div>
                    }
                    
                    {/*在线开盘 3*/}
                    {
                    <div title="在线开盘" className={cx(activityModalObj.activityType == '3' ? '' : 'hidden')}>
                        <ListPage pageProps={pageProps['3']}/>
                    </div>
                    }

                </div>
            </Modal>
        )
    }
        

}